//
//  XQHUD.m
//  JoinPeso
//
//  Created by 小琦 on 2024/11/20.
//

#import "XQHUD.h"
#import "MBProgressHUD.h"

@implementation XQHUD

+ (void)showLoadingInView:(UIView *)view {
    [self showLoadingInView:view title:@""];
}

+ (void)showLoadingInView:(UIView *)view title:(NSString *)title {
    [self showLoadingInView:view title:title detailText:@"" minSize:CGSizeMake(102, 85)];
}

+ (void)showLoadingInView:(UIView *)view title:(NSString *)title detailText:(nonnull NSString *)detailText minSize:(CGSize)minSize {
    
    [self showLoadingInView:view title:title detailText:detailText labelColor:[UIColor whiteColor] bgColor:[UIColor colorWithRed:62/255. green:62/255. blue:62/255. alpha:0.6] minSize:minSize];
}

+ (void)showLoadingInView:(UIView *)view title:(NSString *)title detailText:(NSString *)detailText labelColor:(UIColor *)labelColor bgColor:(UIColor *)bgColor minSize:(CGSize)minSize {
    [MBProgressHUD hideHUDForView:view animated:YES];
    
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:NO];
    hud.userInteractionEnabled = NO;
    hud.labelColor = labelColor;
    hud.color = bgColor;
    hud.margin = 15.f;
    hud.cornerRadius = 8.f;
    hud.mode = MBProgressHUDModeIndeterminate;
    hud.labelText = title;
    hud.detailsLabelText = detailText;
    hud.labelFont = [UIFont systemFontOfSize:14.f];
    hud.yOffset = 0.0f;
    hud.minSize = minSize;
}

+ (void)hideLoadindInView:(UIView *)view {
    [MBProgressHUD hideHUDForView:view animated:YES];
}


@end
